package cn.mldn.microboot.controller;

import cn.mldn.microboot.service.IMemberService;
import cn.mldn.microboot.util.controller.AbstractBaseController;
import cn.mldn.microboot.vo.Member;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * description:
 * Created by gy on 2017/8/13.
 */
@Controller
public class MemberController extends AbstractBaseController {

    private Logger log = LoggerFactory.getLogger(getClass());

    @ApiOperation(value = "hello world展示",notes = "就是一个展示的页面")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "hello world",value = "展示方法",required = false,dataType = "string")
    })
    @RequestMapping(value = "/get",method = RequestMethod.GET)
    @ResponseBody
    public String get() {
        log.info("*********info*******");
        log.error("********error******");
        return "hello world";
    }

    @RequestMapping(value = "/addPre", method = RequestMethod.GET)
    public String addPre() {
        return "member_add";
    }

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public Object add(Member vo) {
        return vo;
    }

    @Resource
    private IMemberService memberService;

    @RequestMapping(value = "/member_get",method = RequestMethod.GET)
    @ResponseBody
    public Object memberAdd(String mid){
        return this.memberService.get(mid);
    }
}
